package com.lovo.test.LicensingSystem;

import javax.swing.*;

public class GuiPoker extends JFrame {

    public GuiPoker(){

        DouDiZhu.init();
        DouDiZhu.xipai();
        DouDiZhu.fapai();
//        DouDiZhu.sort(DouDiZhu.getList());
        //设置空布局
        this.setLayout(null);

        int a =500;
        for (int i = 0; i < 17; i++) {
            ImageIcon image = PokerUtil.getIcon("/pokerImg/" + DouDiZhu.getPlayer1().get(i) + ".jpg");
            JLabel jLabel = new JLabel(image);
            jLabel.setBounds(10, a, 105, 150);
            this.add(jLabel);
            a -= 30;
        }

        int b =780;
        for (int i = 0; i < 17; i++) {
            ImageIcon image = PokerUtil.getIcon("/pokerImg/" + DouDiZhu.getPlayer1().get(i) + ".jpg");
            JLabel jLabel = new JLabel(image);
            jLabel.setBounds(b, 600, 105, 150);
            this.add(jLabel);
            b -= 30;
        }

        int c =500;
        for (int i = 0; i < 17; i++) {
            ImageIcon image = PokerUtil.getIcon("/pokerImg/" + DouDiZhu.getPlayer1().get(i) + ".jpg");
            JLabel jLabel = new JLabel(image);
            jLabel.setBounds(1070, c, 105, 150);
            this.add(jLabel);
            c -= 30;
        }

        int d =600;
        for (int i = 0; i < 3; i++) {
            ImageIcon image = PokerUtil.getIcon("/pokerImg/" + DouDiZhu.getPlayer1().get(i) + ".jpg");
            JLabel jLabel = new JLabel(image);
            jLabel.setBounds(d, 20, 105, 150);
            this.add(jLabel);
            d -= 30;
        }

        //设置窗口大小
        this.setSize(1200, 800);
        //设置窗口标题
        this.setTitle("欢乐斗地主");
        //设置标题图片
//        this.setIconImage(titleImg);
        //设置窗体居中
        this.setLocationRelativeTo(null);
        //设置窗口关闭时结束程序
        this.setDefaultCloseOperation(EXIT_ON_CLOSE);
        //设置窗体可见，这项一定要写在最后
        this.setVisible(true);
    }

    public static void main(String[] args) {

        new GuiPoker();
    }

}
